import React from 'react';
import SonItem from './component/sonItem';
class adminIndex extends React.Component {
  // constructor(props) {
  //     super(props);
  state = {
    text: '父组件的文字',
    arr: [
      {
        userName: '张三',
        text: '123333',
        result: true
      },
      {
        userName: '李四',
        text: '345555',
        result: false
      },
      {
        userName: '吴无',
        text: '567777',
        result: true
      },
      {
        userName: '刘能',
        text: '789999',
        result: true
      }
    ],
    temp: '1'
  };

  getText(data) {
    this.setState({
      text: data
    });
  }
  getTemp(data) {
    this.setState({
      temp: data
    });
  }
  // }
  render() {
    return (
      <div>
        <h1>后台页面</h1>
        <SonItem
          arr={this.state.arr}
          emitText={this.getText.bind(this)}
          temp={this.state.temp}
          emitTemp={this.getTemp.bind(this)}
        ></SonItem>
        <p>加载的文本:{this.state.text}</p>
        <div>---------------------------------------------------------------</div>
      </div>
    );
  }
}

export default adminIndex;
